home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / WorldScript.a < prev   
Encoding:
Text File  |  1995-04-18  |  11.8 KB  |  395 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Contains:    WorldScript I Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  21. __WORLDSCRIPT__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  30.     include 'Traps.a'
  31.     ENDIF
  32.  
  33.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  34.     include 'QuickdrawText.a'
  35.     ENDIF
  36. ;        include 'MixedMode.a'                                        ;
  37.  
  38. kVariableLengthArray            EQU        1
  39.  
  40. ; typedef UInt16             WSIOffset
  41. ; typedef UInt8             WSIByteCount
  42. ; typedef UInt8             WSIByteIndex
  43. ; offset from start of sub-table to row in state table 
  44. ; typedef UInt16             WSIStateOffset
  45. ; typedef UInt32             WSITableOffset
  46. ; typedef UInt16             WSISubtableOffset
  47. ; typedef UInt16             WSIGlyphcode
  48. ; typedef UInt32             WSITableIdentifiers
  49.  
  50. kScriptSettingsTag                EQU        'info'
  51. kMetamorphosisTag                EQU        'mort'
  52. kGlyphExpansionTag                EQU        'g2g#'
  53. kPropertiesTag                    EQU        'prop'
  54. kJustificationTag                EQU        'kash'
  55. kCharToGlyphTag                    EQU        'cmap'
  56. kGlyphToCharTag                    EQU        'pamc'
  57. kFindScriptRunTag                EQU        'fstb'
  58.  
  59. ;***             L O O K U P    T A B L E    T Y P E S        ***
  60. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  61. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  62. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  63. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  64. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  65.  
  66. ; typedef unsigned short     WSILookupTableFormat
  67. ; typedef unsigned short     WSILookupValue
  68. ; An offset from the beginning of the lookup table 
  69. ; typedef unsigned short     WSILookupOffset
  70. ;    FORMAT SPECIFIC DEFINITIONS 
  71. ;
  72. ;        lookupSimpleArray:
  73. ;        
  74. ;        This is a simple array which maps all glyphs in the font
  75. ;        to lookup values.
  76. ;    
  77. WSILookupArrayHeader     RECORD    0
  78. lookupValues             ds.w   1        ; offset: $0 (0)        ; The array of values indexed by glyph code 
  79. sizeof                     EQU *            ; size:   $2 (2)
  80.                         ENDR
  81.  
  82. ; typedef struct WSILookupArrayHeader  WSILookupArrayHeader
  83. ;
  84. ;        lookupTrimmedArray:
  85. ;        
  86. ;        This is a single trimmed array which maps a single range
  87. ;        of glyhs in the font to lookup values.
  88. ;    
  89. WSILookupTrimmedArrayHeader RECORD    0
  90. firstGlyph                 ds.w   1        ; offset: $0 (0)
  91. limitGlyph                 ds.w   1        ; offset: $2 (2)
  92. valueArray                 ds.w   1        ; offset: $4 (4)
  93. sizeof                     EQU *            ; size:   $6 (6)
  94.                         ENDR
  95.  
  96. ; typedef struct WSILookupTrimmedArrayHeader  WSILookupTrimmedArrayHeader
  97. ; The format specific part of the subtable header 
  98. WSILookupFormatSpecificHeader RECORD    0
  99. lookupArray                 ds     WSILookupArrayHeader ; offset: $0 (0)
  100.                          ORG 0
  101. trimmedArray             ds     WSILookupTrimmedArrayHeader ; offset: $0 (0)
  102.                          ORG 6
  103. sizeof                     EQU *            ; size:   $6 (6)
  104.                         ENDR
  105.  
  106. ; typedef union WSILookupFormatSpecificHeader  WSILookupFormatSpecificHeader
  107. ; The overall subtable header 
  108. WSILookupTableHeader     RECORD    0
  109. format                     ds.w   1        ; offset: $0 (0)        ; table format 
  110. fsHeader                 ds.w   3        ; offset: $2 (2)        ; format specific header 
  111. sizeof                     EQU *            ; size:   $8 (8)
  112.                         ENDR
  113.  
  114. ; typedef struct WSILookupTableHeader  WSILookupTableHeader
  115. ;***        G L Y P H    E X P A N S I O N    ***
  116.  
  117. ; fixed 1.0 
  118. kCurrentGlyphExpansionVersion    EQU        $00010000
  119.  
  120. ; typedef unsigned short     GlyphExpansionFormats
  121.  
  122. GlyphExpansionLookupFormat        EQU        1
  123. GlyphExpansionContextualFormat    EQU        2
  124.  
  125. ExpandedGlyphCluster     RECORD    0
  126. numGlyphs                 ds.b   1        ; offset: $0 (0)
  127. bestGlyph                 ds.b   1        ; offset: $1 (1)
  128. glyphs                     ds.w   1        ; offset: $2 (2)
  129. sizeof                     EQU *            ; size:   $4 (4)
  130.                         ENDR
  131.  
  132. ; typedef struct ExpandedGlyphCluster  ExpandedGlyphCluster
  133. ExpandedGlyphOffset     RECORD    0
  134. glyph                     ds.w   1        ; offset: $0 (0)
  135. offset                     ds.w   1        ; offset: $2 (2)        ; offset to ExpandedGlyphCluster 
  136. sizeof                     EQU *            ; size:   $4 (4)
  137.                         ENDR
  138.  
  139. ; typedef struct ExpandedGlyphOffset  ExpandedGlyphOffset
  140. GlyphExpansionStateTable RECORD    0
  141. stateTableOffset         ds.w   1        ; offset: $0 (0)
  142. classTableOffset         ds.w   1        ; offset: $2 (2)
  143. actionTableOffset         ds.w   1        ; offset: $4 (4)        ; state, class and actions tables follow here... 
  144. sizeof                     EQU *            ; size:   $6 (6)
  145.                         ENDR
  146.  
  147. ; typedef GlyphExpansionStateTable  GlyphExpansionStateTable
  148. GlyphExpansionTable     RECORD    0
  149. version                     ds.l   1        ; offset: $0 (0)
  150. format                     ds.w   1        ; offset: $4 (4)
  151. expansionNumer             ds.w   1        ; offset: $6 (6)
  152. expansionDenom             ds.w   1        ; offset: $8 (8)        ; num/denom ratio for expansion <2> 
  153. stateTable                 ds     GlyphExpansionStateTable ; offset: $A (10)
  154.                          ORG 10
  155. lookup                     ds     WSILookupTableHeader ; offset: $A (10) ; expanded glyph clusters follow here... 
  156.                          ORG 18
  157. sizeof                     EQU *            ; size:   $12 (18)
  158.                         ENDR
  159.  
  160. ; typedef struct GlyphExpansionTable  GlyphExpansionTable
  161. ; Glyph-to-Character constants and types  
  162.  
  163. kCurrentGlyphToCharVersion        EQU        $00010100
  164.  
  165. ; typedef unsigned short     GlyphToCharLookupFormats
  166.  
  167. kGlyphToCharLookup8Format        EQU        1
  168. kGlyphToCharLookup16Format        EQU        2
  169. kGlyphToCharLookup32Format        EQU        3
  170.  
  171. ; typedef UInt8             GlyphToCharFontIndex
  172. ; typedef UInt8             QDGlyphcode
  173. GlyphToCharActionTable     RECORD    0
  174. fontNameOffset             ds.w   1        ; offset: $0 (0)        ; offset relative to this table 
  175. actions                     ds     WSILookupTableHeader ; offset: $2 (2) ; only support lookupSimpleArray format for now 
  176. sizeof                     EQU *            ; size:   $A (10)
  177.                         ENDR
  178.  
  179. ; typedef struct GlyphToCharActionTable  GlyphToCharActionTable
  180. GlyphToCharActionHeader RECORD    0
  181. numTables                 ds.w   1        ; offset: $0 (0)        ; 0..n 
  182. offsets                     ds.w   1        ; offset: $2 (2)        ; offsets from start of action table header 
  183. sizeof                     EQU *            ; size:   $4 (4)
  184.                         ENDR
  185.  
  186. ; typedef struct GlyphToCharActionHeader  GlyphToCharActionHeader
  187. GlyphToCharHeader         RECORD    0
  188. version                     ds.l   1        ; offset: $0 (0)
  189. actionOffset             ds.w   1        ; offset: $4 (4)        ; offset to GlyphToCharActionHeader 
  190. format                     ds.w   1        ; offset: $6 (6)        ; size of font mask 
  191. mappingTable             ds     WSILookupTableHeader ; offset: $8 (8)
  192. sizeof                     EQU *            ; size:   $10 (16)
  193.                         ENDR
  194.  
  195. ; typedef struct GlyphToCharHeader  GlyphToCharHeader
  196. ; JUSTIFICATION TYPES
  197. ;    WorldScript supports justification of text using insertion. The justification
  198. ;    table specifies a insertion string to insert between 2 specified glyphs.
  199. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  200. ;    the higher the priority the more justification strings inserted at that position.
  201. ;    
  202. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  203. ;    state table.
  204. ;    
  205. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  206. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  207. ;    per inserting string is specified in the justification table.
  208. ;
  209. ;
  210.  
  211. ; 1.0 not supported 
  212. kCurrentJustificationVersion    EQU        $0200
  213.  
  214. kJustificationStateTableFormat    EQU        1
  215.  
  216. ; WSI's internal limitation <12> 
  217. kMaxJustificationStringLength    EQU        13
  218.  
  219. ; typedef UInt8             WSIJustificationPriority
  220.  
  221. WSIJustificationSetMarkMask        EQU        $80
  222.  
  223. WSIJustificationStateEntry RECORD    0
  224. markPriority             ds.b   1        ; offset: $0 (0)        ; non-zero priorities means insertion 
  225. priority                 ds.b   1        ; offset: $1 (1)
  226. newState                 ds.w   1        ; offset: $2 (2)
  227. sizeof                     EQU *            ; size:   $4 (4)
  228.                         ENDR
  229.  
  230. ; typedef struct WSIJustificationStateEntry  WSIJustificationStateEntry
  231. ; typedef unsigned short     WSIJustificationClasses
  232.  
  233. wsiJustEndOfLineClass            EQU        0
  234. wsiJustEndOfRunClass            EQU        1
  235. wsiJustDeletedGlyphClass        EQU        2
  236. wsiJustUserDefinedClass            EQU        3
  237.  
  238. ; typedef unsigned short     WSIJustificationStates
  239.  
  240. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  241. wsiStartOfRunState                EQU        1
  242. wsiUserDefinedState                EQU        2
  243.  
  244. ; pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  245. ; typedef UInt8             WSIJustificationClassOffset
  246. WSIJustificationStateTable RECORD    0
  247. maxPriorities             ds.w   1        ; offset: $0 (0)
  248. rowWidth                 ds.w   1        ; offset: $2 (2)        ; width of a state table row in bytes 
  249. classTableOffset         ds.w   1        ; offset: $4 (4)
  250. stateTableOffset         ds.w   1        ; offset: $6 (6)
  251. sizeof                     EQU *            ; size:   $8 (8)
  252.                         ENDR
  253.  
  254. ; typedef struct WSIJustificationStateTable  WSIJustificationStateTable
  255. WSIJustificationHeader     RECORD    0
  256. version                     ds.w   1        ; offset: $0 (0)
  257. format                     ds.w   1        ; offset: $2 (2)
  258. scaling                     ds     Point    ; offset: $4 (4)        ; numer/denom scaling of priority weights <7> 
  259. spacesPerInsertion         ds.w   1        ; offset: $8 (8)        ; # of $20 chars in justification insertion string <12> 
  260. justStringOffset         ds.w   1        ; offset: $A (10)        ; offset to justification string 
  261. stateTable                 ds     WSIJustificationStateTable ; offset: $C (12) ; long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  262. sizeof                     EQU *            ; size:   $14 (20)
  263.                         ENDR
  264.  
  265. ; typedef struct WSIJustificationHeader  WSIJustificationHeader
  266. ; Line Layout's Property table version <11> 
  267.  
  268. ; v1.0 
  269. currentPropsTableVersion        EQU        $00010000
  270.  
  271. ; ??? is this right 
  272. kCharToGlyphCurrentVersion        EQU        0100
  273.  
  274. ; pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  275. kScriptsDefaultJustWeight        EQU        -1
  276.  
  277. WSIGlyphInfoRec         RECORD    0
  278. qdChar                     ds.b   1        ; offset: $0 (0)
  279. rightToLeft                 ds.b   1        ; offset: $1 (1)        ; !0 means rightToLeft, 0 means leftToRight 
  280. fontID                     ds.w   1        ; offset: $2 (2)
  281. originalOffset             ds.w   1        ; offset: $4 (4)        ; or negative original offset if not in original text input 
  282. unused                     ds.w   1        ; offset: $6 (6)        ; long-align 
  283. sizeof                     EQU *            ; size:   $8 (8)
  284.                         ENDR
  285.  
  286. ; typedef struct WSIGlyphInfoRec  WSIGlyphInfoRec, **WSIGlyphInfoHandle
  287. ; typedef Handle             WSILayoutHandle
  288. ;
  289. ; pascal WSILayoutHandle NewWSILayout(WSILayoutHandle layoutH, Ptr text, short txLength, short lineDirection, unsigned long flags, OSErr *err)
  290. ;
  291.     IF ¬ GENERATINGCFM THEN
  292.         Macro
  293.         _NewWSILayout
  294.             dc.w     $2F3C
  295.             dc.w     $8414
  296.             dc.w     $0040
  297.             dc.w     $A8B5
  298.         EndM
  299.     ELSE
  300.         IMPORT_CFM_FUNCTION    NewWSILayout
  301.     ENDIF
  302.  
  303. ;
  304. ; pascal WSILayoutHandle JustifyWSILayout(WSILayoutHandle layoutH, Fixed slop, short priorityWeight, JustStyleCode styleRunPosition, Point numer, Point denom, OSErr *err)
  305. ;
  306.     IF ¬ GENERATINGCFM THEN
  307.         Macro
  308.         _JustifyWSILayout
  309.             dc.w     $2F3C
  310.             dc.w     $8418
  311.             dc.w     $0042
  312.             dc.w     $A8B5
  313.         EndM
  314.     ELSE
  315.         IMPORT_CFM_FUNCTION    JustifyWSILayout
  316.     ENDIF
  317.  
  318. ;
  319. ; pascal Fixed MeasureWSILayout(WSILayoutHandle layoutH, Point numer, Point denom)
  320. ;
  321.     IF ¬ GENERATINGCFM THEN
  322.         Macro
  323.         _MeasureWSILayout
  324.             dc.w     $2F3C
  325.             dc.w     $840C
  326.             dc.w     $0044
  327.             dc.w     $A8B5
  328.         EndM
  329.     ELSE
  330.         IMPORT_CFM_FUNCTION    MeasureWSILayout
  331.     ENDIF
  332.  
  333. ;
  334. ; pascal void DrawWSILayout(WSILayoutHandle layoutH, Point numer, Point denom)
  335. ;
  336.     IF ¬ GENERATINGCFM THEN
  337.         Macro
  338.         _DrawWSILayout
  339.             dc.w     $2F3C
  340.             dc.w     $800C
  341.             dc.w     $0046
  342.             dc.w     $A8B5
  343.         EndM
  344.     ELSE
  345.         IMPORT_CFM_FUNCTION    DrawWSILayout
  346.     ENDIF
  347.  
  348. ; "low-level" routines 
  349. ;
  350. ; pascal WSIGlyphInfoHandle GetWSILayoutParts(WSILayoutHandle layoutH, WSIGlyphInfoHandle destH, short *numGlyphs, OSErr *err)
  351. ;
  352.     IF ¬ GENERATINGCFM THEN
  353.         Macro
  354.         _GetWSILayoutParts
  355.             dc.w     $2F3C
  356.             dc.w     $8410
  357.             dc.w     $0048
  358.             dc.w     $A8B5
  359.         EndM
  360.     ELSE
  361.         IMPORT_CFM_FUNCTION    GetWSILayoutParts
  362.     ENDIF
  363.  
  364. ;
  365. ; pascal void DrawWSIGlyphs(short length, Ptr qdCodes, Point numer, Point denom)
  366. ;
  367.     IF ¬ GENERATINGCFM THEN
  368.         Macro
  369.         _DrawWSIGlyphs
  370.             dc.w     $2F3C
  371.             dc.w     $800E
  372.             dc.w     $004A
  373.             dc.w     $A8B5
  374.         EndM
  375.     ELSE
  376.         IMPORT_CFM_FUNCTION    DrawWSIGlyphs
  377.     ENDIF
  378.  
  379. ;
  380. ; pascal Fixed xMeasureWSIGlyphs(Ptr *qdCodes, short length, Point numer, Point denom)
  381. ;
  382.     IF ¬ GENERATINGCFM THEN
  383.         Macro
  384.         _xMeasureWSIGlyphs
  385.             dc.w     $2F3C
  386.             dc.w     $840E
  387.             dc.w     $004C
  388.             dc.w     $A8B5
  389.         EndM
  390.     ELSE
  391.         IMPORT_CFM_FUNCTION    xMeasureWSIGlyphs
  392.     ENDIF
  393.  
  394.     ENDIF ; __WORLDSCRIPT__
  395.